using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BlogSystem.Ability.Docking.NewsApp;
using BlogSystem.Ability.Docking.NewsApp.Dto;
using Microsoft.AspNetCore.Mvc;

namespace BlogSystem.Web.Controllers
{
    public class NewsController : BaseController
    {
        public INewsServicer NewsServicer { get; set; }

        [HttpGet]
        public async Task<List<NewsDto>> GetNewsDtoListAsync(int pageIndex = 1, int pageSize = 1)
        {
            return await  NewsServicer.GetNewsDtoListAsync(pageIndex, pageSize);
        }

        [HttpGet("Count")]
        public async Task<int> GetTotalCountAsync()
        {
           return await NewsServicer.GetTotalCountAsync();
        }

        [HttpGet("{id}")]
        public async Task<NewsDto> GetNewsDtoAsync(int id)
        {
            return await NewsServicer.GetNewsDtoAsync(id);
        }
    }
}